package com.meibei.ljl.mymusic.base;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

/**
 * Created by xy on 16/10/9.
 */
public abstract class BaseActivity extends AppCompatActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getLayoutId() != -1 && getLayoutId() != 0) {
            setContentView(getLayoutId());
        }
        initView();
        setListener();
        initData();
    }

    /**
     * 设置布局文件
     */
    public abstract int getLayoutId();

    /**
     * 初始化控件
     */
    public abstract void initView();

    /**
     * 设置控件的监听
     */
    public abstract void setListener();

    /**
     * 初始化数据
     */
    public abstract void initData();
}
